package org.example.hw.dto.link;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.example.hw.dto.AbstractViewDto;
import org.example.hw.model.Link;
import org.example.hw.model.Link.Visibility;

public class ViewLinkDto extends AbstractViewDto {

	private String originalUrl;

	private String customUrl;

	private Visibility visibility;

	private Long count;

	public ViewLinkDto(Link link) {
		this.originalUrl = link.getOriginalUrl();
		this.customUrl = link.getCustomUrl();
		this.visibility = link.getVisibility();
		this.count = link.getCount();
		this.setCreatedBy(link.getCreatedBy());
		this.setCreationTime(link.getCreationTime());
		this.setModifiedBy(link.getModifiedBy());
		this.setModificationTime(link.getModificationTime());
	}

	public String getOriginalUrl() {
		return originalUrl;
	}

	public void setOriginalUrl(String originalUrl) {
		this.originalUrl = originalUrl;
	}

	public String getCustomUrl() {
		return customUrl;
	}

	public void setCustomUrl(String customUrl) {
		this.customUrl = customUrl;
	}

	public Visibility getVisibility() {
		return visibility;
	}

	public void setVisibility(Visibility visibility) {
		this.visibility = visibility;
	}

	public Long getCount() {
		return count;
	}

	public void setCount(Long count) {
		this.count = count;
	}

	@Override
	public String toString() {
		return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).
				append("originalUrl", originalUrl).
				append("customUrl", customUrl).
				append("visibility", visibility).
				append("count", count).
				appendSuper(super.toString()).
				toString();
	}

}
